<template>
    <div>
    <div class="mmm">管理收货地址</div>
<van-address-list
  v-model="chosenAddressId"
  :list="list"
  default-tag-text="默认"
  @add="onAdd"
  @edit="onEdit"
/>
<router-link to="/newaddress"></router-link>
    </div>
</template>

<script setup>
import { ref } from 'vue';
import { Toast } from 'vant';
import { useRouter } from 'vue-router';
const router=useRouter()
 const chosenAddressId = ref('1');
  const list = [
      {
        id: '1',
        name: '张三',
        tel: '13000000000',
        address: '浙江省杭州市西湖区文三路 138 号东方通信大厦 7 楼 501 室',
        isDefault: true,
      },
      {
        id: '2',
        name: '李四',
        tel: '1310000000',
        address: '浙江省杭州市拱墅区莫干山路 50 号',
      },
       {
        id: '2',
        name: '李四',
        tel: '1310000000',
        address: '浙江省杭州市拱墅区莫干山路 50 号',
      },
    ];
      const onAdd = () => {
        Toast('新增地址')
       router.push('/newaddress')
        };
    const onEdit = (item, editaddress
    ) => {
      Toast('编辑地址:' + editaddress)
     router.push('/editaddress')
      };

  
</script>

<style lang="scss" scoped>
.mmm{
  width: 1.5rem;
  height: 0.25rem;
  margin:0 auto;
  font-size:0.18rem;
  text-align:center;
  line-height: 0.25rem;
}
</style>